//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "FritschButlandLogCubic.h"
using namespace Cephei::QL::Math::Interpolations;
#include <gen/QL/Math/Interpolations/LogCubicInterpolation.h>
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (boost::shared_ptr<QuantLib::FritschButlandLogCubic>& childNative, Object^ owner) : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
#ifdef HANDLE
	_phFritschButlandLogCubic = NULL;
#endif
	_ppFritschButlandLogCubic = &childNative;
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppFritschButlandLogCubic));
}
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (QuantLib::FritschButlandLogCubic& childNative, Object^ owner) : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
#ifdef HANDLE
	_phFritschButlandLogCubic = NULL;
#endif
	_ppFritschButlandLogCubic = new boost::shared_ptr<QuantLib::FritschButlandLogCubic> (&childNative);
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppFritschButlandLogCubic));
    _FritschButlandLogCubicOwner = owner;
    _LogCubicInterpolationOwner = owner;
}

Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (CFritschButlandLogCubic^ copy) : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
#ifdef HANDLE
	_phFritschButlandLogCubic = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppFritschButlandLogCubic = new boost::shared_ptr<QuantLib::FritschButlandLogCubic> (copy->GetShared());
        _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppFritschButlandLogCubic));
    }
}
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (PLATFORM::Type^ t) : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
#ifdef HANDLE
	_phFritschButlandLogCubic = NULL;
#endif
	if (!t->IsSubclassOf(CFritschButlandLogCubic::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (QuantLib::Handle<QuantLib::FritschButlandLogCubic>& childNative, Object^ owner)  : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
	_phFritschButlandLogCubic = &childNative;
	_ppFritschButlandLogCubic = &static_cast<boost::shared_ptr<QuantLib::FritschButlandLogCubic>>(childNative.currentLink());
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppFritschButlandLogCubic));
    _FritschButlandLogCubicOwner = owner;
}
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (QuantLib::Handle<QuantLib::FritschButlandLogCubic> childNative)  : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
	_phFritschButlandLogCubic = &childNative;
	_ppFritschButlandLogCubic = &static_cast<boost::shared_ptr<QuantLib::FritschButlandLogCubic>>(childNative.currentLink());
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppFritschButlandLogCubic));
}
#endif
#ifdef STRUCT
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::CFritschButlandLogCubic (QuantLib::FritschButlandLogCubic childNative)  : CLogCubicInterpolation(CFritschButlandLogCubic::typeid)
{
#ifdef HANDLE
	_phFritschButlandLogCubic = NULL;
#endif
	_ppFritschButlandLogCubic = new boost::shared_ptr<QuantLib::FritschButlandLogCubic> (new QuantLib::FritschButlandLogCubic (childNative));
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppFritschButlandLogCubic));
}
#endif

Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::~CFritschButlandLogCubic ()
{
    if (_ppFritschButlandLogCubic != NULL)
    {
	    delete _ppFritschButlandLogCubic;
        _ppFritschButlandLogCubic = NULL;
    }
}
Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::!CFritschButlandLogCubic ()
{
    if (_ppFritschButlandLogCubic != NULL)
    {
	    delete _ppFritschButlandLogCubic;
    }
}
QuantLib::FritschButlandLogCubic& Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::GetReference ()
{
    if (_ppFritschButlandLogCubic == NULL) throw REFNEW NativeNullException ();
	return **_ppFritschButlandLogCubic;
}
boost::shared_ptr<QuantLib::FritschButlandLogCubic>& Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::GetShared ()
{
    if (_ppFritschButlandLogCubic == NULL) throw REFNEW NativeNullException ();
	return *_ppFritschButlandLogCubic;
}
QuantLib::FritschButlandLogCubic* Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::GetPointer ()
{
    if (_ppFritschButlandLogCubic == NULL) throw REFNEW NativeNullException ();
	return &**_ppFritschButlandLogCubic;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::FritschButlandLogCubic>& Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::GetHandle ()
{
	if (_phFritschButlandLogCubic == NULL)
	{
		_phFritschButlandLogCubic = new Handle<QuantLib::FritschButlandLogCubic> (*_ppFritschButlandLogCubic);
	}
	return *_phFritschButlandLogCubic;
}
#endif
bool Cephei::QL::Math::Interpolations::CFritschButlandLogCubic::HasNative () 
{
	return (_ppFritschButlandLogCubic != NULL);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

